package com.hello.controller;


import com.hello.dto.PetcardDTO;
import com.hello.result.Result;
import com.hello.service.PetcardService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Controller
@RestController
@RequestMapping("/admin/petcard")
@Slf4j
@Api(tags = "宠物卡接口")
public class PetcardController {

    @Autowired
    PetcardService petcardService;
    /**
     * 新增宠物卡
     * @param petcardDTO
     * @return
     */
    @PostMapping
    @ApiOperation(value = "新增宠物卡")
    public Result save(@RequestBody PetcardDTO petcardDTO){
        log.info("新增宠物卡:{}",petcardDTO);
        System.out.println("当前线程id:" + Thread.currentThread().getId());
        petcardService.save(petcardDTO);
        return Result.success();
    }
}
